import menus from './menus'

/**
 * 模拟登录接口
 */
export const login = (params, time = 0) => {
  console.log(params)
  return new Promise(function(resolve, reject) {
    setTimeout(() => {
      resolve({
        code: 1,
        message: '登录成功',
        data: {
          id: 'aabbccddeeff',
          loginName: 'admin',
          userName: 'admin',
          token: 123456,
          roleName: '管理员',
          status: 2
        }
      })
    }, time)
  })
}

/**
 * 模拟登出接口
 */
export const logout = (params, time = 0) => {
  console.log(params)
  return new Promise(function(resolve, reject) {
    setTimeout(() => {
      resolve({
        code: 1,
        message: '登出成功',
        data: {
          token: 123456
        }
      })
    }, time)
  })
}

/**
 * 模拟获取用户信息
 */
export const getUserInfo = (params, time = 0) => {
  console.log(params)
  return new Promise(function(resolve, reject) {
    setTimeout(() => {
      resolve({
        code: 1,
        message: '获取用户信息成功',
        data: {
          id: 'aabbccddeeff',
          loginName: 'admin',
          userName: 'admin',
          token: 123456,
          roleName: '管理员',
          status: 2
        }
      })
    }, time)
  })
}

/**
 * 模拟获取菜单
 */
export const getMenus = (time = 0) => {
  console.log(menus)
  return new Promise(function(resolve, reject) {
    setTimeout(() => {
      resolve({
        code: 1,
        message: '获取菜单成功',
        data: menus
      })
    }, time)
  })
}
